/**
 * EditTopicAction.java 1.0 2007-5-7 下午02:13:20,创建 by yangfan
 */


package org.in4j.bbs.action.topic;

import org.in4j.bbs.action.AbstractAction;
import org.in4j.bbs.common.CommonUtils;
import org.in4j.bbs.model.Topic;
import org.in4j.bbs.model.User;
import org.in4j.bbs.service.TopicService;

/**
 *
 * @author yangfan
 * @version 1.0 2007-5-7 下午02:13:20,创建
 */
@SuppressWarnings("serial")
public class EditTopicAction extends AbstractAction
{
	private Topic topic;
	private TopicService topicService;

	@Override
	public String execute() throws Exception
	{
		User user = getOnlineInfo().getUser();
		if(user.isGuest()) return ERROR;	//TODO 完善权限验证
		topic.setUpdateUser(user.getName());
		topic.setUpdateTime(CommonUtils.currentTimestamp());
		topicService.updateTopic(topic);
		this.topic = topicService.getTopicById(topic.getId());
		return SUCCESS;
	}

	public Topic getTopic()
	{
		return topic;
	}

	public void setTopic(Topic topic)
	{
		this.topic = topic;
	}

	public void setTopicService(TopicService topicService)
	{
		this.topicService = topicService;
	}
}
